<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/pages/common/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta charset="utf-8" />
<title>userAdmin</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<%@ include file="/pages/common/auth_header4page.jsp"%>
<script type="text/javascript">
	function addOne(){
		window.location.href='${ctx}/toAddUser.do';
	}
	
	function getParameterStr(){
		var parameterStr = "";
		parameterStr = parameterStr + "&name=" + $("#name").val();
		return parameterStr;
	}
	
	function gotoFirst(){
		window.location.href='${ctx}/pageFindAllUser.do?currentPage=1'+ getParameterStr();
	}
	
	function gotoPrevious(){
		var currentIndex = ${page.currentPage} - 1;
		if(currentIndex < 1)
			currentIndex = 1;
		window.location.href='${ctx}/pageFindAllUser.do?currentPage=' + currentIndex + getParameterStr();
	}
	
	function gotoNext(){
		var currentIndex = ${page.currentPage} + 1;
		if(currentIndex > ${page.totalPage})
			currentIndex = ${page.totalPage};
		window.location.href='${ctx}/pageFindAllUser.do?currentPage=' + currentIndex + getParameterStr();
	}
	
	function gotoLast(){
		window.location.href='${ctx}/pageFindAllUser.do?currentPage=${page.totalPage}' + getParameterStr();
	}
	
	function delcfm() {
        if (!confirm("确认要删除？")) {
            return  false;
        } else {
        	return true;
        }
    }
</script>

</head>
<body>
	<div class="page-content" style="padding: 8px 20px 0px;">
		<div class="page-header">
			<h1>
				用户
			</h1>
		</div>
		
		<div class="page-header">
			<form name="form1" method="post" action="${ctx}/pageFindAllUser.do">
				<div class="page-btn">
					<ul>
						<li>
								姓名：<input type="text" name="name" id="name" value="${user.name}"  >
							</li>
							<li class="query-buttons-1">
								<input id="btns" type="submit" name="btnSubmit" value="查 询"></iuput>
								
						    </li>
						    <li class="query-buttons-2">
								<input id="btns" type="button" name="btnSubmit" onclick="addOne()" value="添 加"></iuput>
						    </li>
					</ul>
	            </div>
			</form>
		</div>
		
		<div class="row">
			<div class="col-xs-12">
				<div class="table-responsive">
					<table id="sample-table-1"
						class="table table-striped table-bordered table-hover">
						<thead>
							<tr>
								<th>性别</th>
								<th>姓名</th>
								<th>描述</th>
								<th>管理</th>
							</tr>
						</thead>

						<tbody>
						<c:forEach items="${page.rows}" var="row">
							<tr>
							
								<th>${row.sex}</th>
								<th>${row.name}</th>
								<th>${row.description}</th>
								<td>
									<a href="${ctx}/getUserInfo.do?id=${row.id}">查看</a>
									<a href="${ctx}/toEditUser.do?id=${row.id}">编辑</a>
									<a href="${ctx}/deleteUser.do?id=${row.id}" onClick="javascript:return delcfm();">删除</a>
								</td>
							</tr>
						</c:forEach>
						

							<tr class="tabbottom">
								<td colspan="4">
									<div class="page-number">
										<ul>
											<li>总记录: ${page.totalCount}, 总页数: ${page.totalPage}，当前第：${page.currentPage} 页</li>
											<li><img src="./images/page_leftt.gif" alt=""
												style="cursor: pointer;" onclick="gotoFirst()"> <img
												src="./images/page_left.gif" alt=""
												style="cursor: pointer;" onclick="gotoPrevious()"></li>
											<li>
												<img src="./images/page_right.gif" alt="" style="cursor: pointer;" onclick="gotoNext()"> 
												<img src="./images/page_rightt.gif" alt="" style="cursor: pointer;" onclick="gotoLast()"></li>
										</ul>
									</div>
								</td>
							</tr>
						</tbody>
					</table>
					<div class="footer-inner">
						<div class="footer-content">
							<span class="bigger-120"> <span class="blue bolder">Ace
							</span>Application ? 2013-2014
							</span> <span class="action-buttons"> <img class="footer1"
								src="./images/footer1.png" width="18" height="18" alt="" /> <img
								class="footer2" src="./images/footer2.png" width="18"
								height="18" alt="" /> <img class="footer3"
								src="./images/footer3.png" width="18" height="18" alt="" />
							</span>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>